#include once "mud-gui/ui.bi"
#include once "mud-gui/widgets/GridLayout.bi"
#include once "mud-gui/widgets/LineEdit.bi"
#include once "mud-gui/widgets/PushButton.bi"
#include once "mud-gui/widgets/Label.bi"

using ui

dim as GridLayout ptr mw
dim shared as LineEdit ptr ledit, le2, textbox
dim as PushButton ptr pb, pb2

SLOT(printLineEdit)

	ConsolePrint( "Text: " & ledit->text )
	ledit->setText = ""
	return 1

ENDSLOT

SLOT(printPassword)

	ConsolePrint( "Password: " & le2->text )
	le2->setText = ""
	return 1

ENDSLOT

if initScreen("LineEdit Example", 640, 240 ) = 0 then
	print "unable to initialize screen."
	end 23
end if

mw = new GridLayout
ledit = new LineEdit
ledit->setPlaceHolder = "Say Something..."
le2 = new LineEdit
le2->setPlaceholder = "Password"
le2->setPasswordChar = "*"
le2->setIsPassword = 1
le2->setRows = 1
textbox = new LineEdit
textbox->setRows = 2
textbox->setMultiLine = 1
pb = new PushButton( NULL, "To Console" )
pb2 = new PushButton( NULL, "To Console" )
connectSignal( pb, clicked, printLineEdit)
connectSignal( pb2, clicked, printPassword)
'              ^   ^        ^
'              |   |        + The SLOT to call when this signal is triggered.
'              |   + The signal you wish to catch.
'              + The object whose signal you want to catch.

mw->sizeGrid(5,4)
ConsolePrint( "1: " & mw->placeWidget( toBaseWidget(ledit), 1,1,2,1 ) )
ConsolePrint( "2: " & mw->placeWidget( toBaseWidget(pb), 3,1 ) )
ConsolePrint( "3: " & mw->placeWidget( toBaseWidget(le2), 1,2,2,2 ) )
ConsolePrint( "4: " & mw->placeWidget( toBaseWidget(pb2), 3,2 ) )
ConsolePrint( "5: " & mw->placeWidget( toBaseWidget(textbox), 4,1,5,1 ) )
ConsolePrint( "ledit columns: " & ledit->columns )
ConsolePrint( "le2 columns: " & le2->columns )
ConsolePrint( "textbox columns: " & textbox->columns )

end runGUI(toBaseWidget(mw))
